# -*- coding:GBK -*-
# -*- Author Zhoutianya -*-

inst = None

def init(api):
    global inst
    if not inst:
        inst = CGameCommand(api)

class CGameCommand(object):
    def __init__(self, api_inst):
        self.api_inst = api_inst
    
    def send_upgrade(self):
        self.api_inst.sender.cs_upgrade()
    
    def send_upgrade_sprite(self, wid):
        self.api_inst.sender.cs_upgrade_sprite(wid = wid)
    
        
    def send_ready(self, weather, sub_mode, difficulty, stage):
        self.api_inst.sender.cs_ready(weather = weather, sub_mode = sub_mode, difficulty = difficulty, stage = stage)
    
    def send_stage(self):
        self.api_inst.sender.cs_stage()
        
    def send_select_sprite(self, wid):
        self.api_inst.sender.cs_select_sprite(wid = wid)
    
    def send_unselect_sprite(self, wid):
        self.api_inst.sender.cs_unselect_sprite(wid = wid)
    
    def send_game_select_end(self):
        self.api_inst.sender.cs_game_select_end()
    
    def send_game_begin(self):
        self.api_inst.sender.cs_game_begin()
        
    def send_pick_up(self, sid):
        self.api_inst.sender.cs_pick_up(sid = sid)

    def send_moveto(self, sid, grid_z, grid_x):
        self.api_inst.sender.cs_moveto(sid = sid, grid_z = grid_z, grid_x = grid_x)
    
    def send_put_down(self, sid, grid_z, grid_x):
        self.api_inst.sender.cs_put_down(sid = sid, grid_z = grid_z, grid_x = grid_x)

    def send_game_decide_end(self, itemlist):
        self.api_inst.sender.cs_game_decide_end(itemlist = itemlist)
    
    def send_game_battle_end(self):
        self.api_inst.sender.cs_game_battle_end()
    
    def send_leave_room(self):
        self.api_inst.sender.cs_leave_room()
    
    def send_use_item(self, type):
        self.api_inst.sender.cs_use_item(type = type)
    
    def send_game_battle_item_end(self):
        self.api_inst.sender.cs_game_battle_item_end()
    
    def send_game_battle_move_end(self):
        self.api_inst.sender.cs_game_battle_move_end()
    
    def send_wizard(self, cmd_str):
        self.api_inst.sender.cs_wizard(cmd_str = cmd_str)
        